package com.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.entity.User;
import com.service.UserService;

@Controller
public class RegisterController {
	@Autowired  
    private UserService UserService;  
	
	 /*public UserService getUserService() {  
	        return UserService;  
	 }  
	  
	 public void setUserInfoService(UserService UserService) {  
	        this.UserService = UserService;  
	 }  */
	
	@RequestMapping(value = "/register_form", method = {RequestMethod.POST})
	public String doRegister(HttpServletRequest request){  
		String email=request.getParameter("email");
		String username=request.getParameter("user");
		String pwd=request.getParameter("password");
		
		User user=new User();
		user.setUid(email);
		user.setName(username);
		user.setPassword(pwd);
		UserService.insert(user);
		return "login.html";  
          	    	
    }  
	
	
	
	
	
}
